﻿using System.Text;

namespace Sharp.Portal.ExtNet.FormField
{
    /// <summary>
    /// 图片字段
    /// </summary>
    public class ImageUploadField : ElementField
    {
        /// <summary>
        /// 图片字段
        /// </summary>
        /// <param name="fieldName"></param>
        public ImageUploadField(string fieldName)
        {
            this.FieldName = fieldName;
        }
        /// <summary>
        /// 生成
        /// </summary>
        /// <param name="nonFirst"></param>
        /// <returns></returns>
        public override string Build(bool nonFirst = false)
        {
            if (this.IsBrowsing() && !this.KeepingXType)
            {
                return "";
            }

            //未完成
            var sb = new StringBuilder();
            sb.AppendFormat("x.FieldContainer().Layout(LayoutType.HBox).FieldLabel(\"上传\").Items(x.Image().Src(Model.{0}).Width(120).Height(90),x.FileUploadField().Name(\"{0}\").AutoId()))", FieldName);



            return sb.ToString();
        }
    }
}
